//
//  ASubmitOrderFormTableViewCell.m
//  DistributorAB
//
//  Created by 主事丫环 on 2019/9/27.
//  Copyright © 2019 主事丫环. All rights reserved.
//

#import "ASubmitOrderFormTableViewCell.h"

@implementation ASubmitOrderFormTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setFrame:(CGRect)frame{
    //frame.origin.x += 10;
    //frame.origin.y += 10;
    frame.size.height -= 10;
    //frame.size.width -= 20;
    [super setFrame:frame];
}

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        UIView *bottomV = [[UIView alloc] init];
        bottomV.frame = CGRectMake(0, 0, KWIDTH, 300);
        bottomV.layer.cornerRadius = 10;
        bottomV.layer.masksToBounds = YES;
        [self.contentView addSubview:bottomV];
        
        UIImageView *proImg = [[UIImageView alloc] init];
        proImg.frame = CGRectMake(16, 15, 59, 59);
        proImg.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        //[proImg setImage:imgname(@"")];
        [bottomV addSubview:proImg];
        self.proImg = proImg;
        
        UILabel *proTitLab = [[UILabel alloc] init];
        //proTitLab.backgroundColor = [UIColor greenColor];
        proTitLab.frame = CGRectMake(proImg.right +10, 15, KWIDTH-32-59-13, 40);
        proTitLab.text = @"厂家生产智能插座接地铜片万能插座五金配件定制磷铜导电弹片";
        proTitLab.numberOfLines = 0;
        proTitLab.font = FontSize(14);
        proTitLab.textColor = [UIColor colorWithHexString:@"#5F5F5F"];
        [bottomV addSubview:proTitLab];
        self.proTitLab = proTitLab;
        
        UILabel *typeTitLab = [[UILabel alloc] init];
        //typeTitLab.backgroundColor = [UIColor redColor];
        typeTitLab.frame = CGRectMake(proImg.right +10, proTitLab.bottom +5, 30, 20);
        typeTitLab.text = @"型号";
        typeTitLab.font = FontSize(14);
        typeTitLab.textColor = [UIColor colorWithHexString:@"#666666"];
        [bottomV addSubview:typeTitLab];
        self.typeTitLab = typeTitLab;
        
        UILabel *typeConLab = [[UILabel alloc] init];
        //typeConLab.backgroundColor = [UIColor redColor];
        typeConLab.frame = CGRectMake(typeTitLab.right +10, proTitLab.bottom +5, KWIDTH/2, 20);
        typeConLab.text = @"AD1543236";
        typeConLab.font = FontSize(14);
        typeConLab.textColor = [UIColor colorWithHexString:@"#272727"];
        [bottomV addSubview:typeConLab];
        self.typeConLab = typeConLab;
        
        UILabel *countTitLab = [[UILabel alloc] init];
        //countTitLab.backgroundColor = [UIColor redColor];
        countTitLab.frame = CGRectMake(24, proImg.bottom +27, 70, 20);
        countTitLab.text = @"预订数量";
        countTitLab.font = FontSize(14);
        countTitLab.textColor = [UIColor colorWithHexString:@"#272727"];
        [bottomV addSubview:countTitLab];
        
        UILabel *countLab = [[UILabel alloc] init];
        //countLab.backgroundColor = [UIColor redColor];
        countLab.frame = CGRectMake(countTitLab.right +20, proImg.bottom +27, KWIDTH/2, 20);
        countLab.text = @"共计10000个";
        countLab.font = FontSize(14);
        countLab.textColor = [UIColor colorWithHexString:@"#272727"];
        [bottomV addSubview:countLab];
        self.countLab = countLab;
        
        UILabel *line = [[UILabel alloc] init];
        line.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        line.frame = CGRectMake(10, countTitLab.bottom +8, KWIDTH -20, 1);
        [bottomV addSubview:line];
        
        UILabel *yxqTitLab = [[UILabel alloc] init];
        //yxqTitLab.backgroundColor = [UIColor redColor];
        yxqTitLab.frame = CGRectMake(24, line.bottom +8, 70, 20);
        yxqTitLab.text = @"有效期";
        yxqTitLab.font = FontSize(14);
        yxqTitLab.textColor = [UIColor colorWithHexString:@"#272727"];
        [bottomV addSubview:yxqTitLab];
        
        UILabel *yxqLab = [[UILabel alloc] init];
        //yxqLab.backgroundColor = [UIColor redColor];
        yxqLab.frame = CGRectMake(countTitLab.right +20, line.bottom +8, KWIDTH/2, 20);
        yxqLab.text = @"2019-10-10 至 2020-10-10";
        yxqLab.font = FontSize(14);
        yxqLab.textColor = [UIColor colorWithHexString:@"#272727"];
        [bottomV addSubview:yxqLab];
        self.yxqLab = yxqLab;
        
        UILabel *line1 = [[UILabel alloc] init];
        line1.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        line1.frame = CGRectMake(10, yxqTitLab.bottom +8, KWIDTH -20, 1);
        [bottomV addSubview:line1];
        
        UILabel *bzqTitLab = [[UILabel alloc] init];
        //bzqTitLab.backgroundColor = [UIColor redColor];
        bzqTitLab.frame = CGRectMake(24, line1.bottom +8, 70, 20);
        bzqTitLab.text = @"质保期";
        bzqTitLab.font = FontSize(14);
        bzqTitLab.textColor = [UIColor colorWithHexString:@"#272727"];
        [bottomV addSubview:bzqTitLab];
        
        UILabel *bzqLab = [[UILabel alloc] init];
        //bzqLab.backgroundColor = [UIColor redColor];
        bzqLab.frame = CGRectMake(countTitLab.right +20, line1.bottom +8, KWIDTH/2, 20);
        bzqLab.text = @"6个月";
        bzqLab.font = FontSize(14);
        bzqLab.textColor = [UIColor colorWithHexString:@"#272727"];
        [bottomV addSubview:bzqLab];
        self.bzqLab = bzqLab;
        
        UILabel *line2 = [[UILabel alloc] init];
        line2.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        line2.frame = CGRectMake(10, bzqTitLab.bottom +8, KWIDTH -20, 1);
        [bottomV addSubview:line2];
        
        UILabel *pfjeTitLab = [[UILabel alloc] init];
        //pfjeTitLab.backgroundColor = [UIColor redColor];
        pfjeTitLab.frame = CGRectMake(24, line2.bottom +8, 80, 20);
        pfjeTitLab.text = @"补贴工时费";
        pfjeTitLab.font = FontSize(14);
        pfjeTitLab.textColor = [UIColor colorWithHexString:@"#CA9F61"];
        [bottomV addSubview:pfjeTitLab];
        
        UILabel *pfjeLab = [[UILabel alloc] init];
        //pfjeLab.backgroundColor = [UIColor redColor];
        pfjeLab.frame = CGRectMake(countTitLab.right +20, line2.bottom +8, KWIDTH/2, 20);
        pfjeLab.text = @"¥30/个";
        pfjeLab.font = FontSize(14);
        pfjeLab.textColor = [UIColor colorWithHexString:@"#CA9F61"];
        [bottomV addSubview:pfjeLab];
        self.pfjeLab = pfjeLab;
        
        UILabel *line3 = [[UILabel alloc] init];
        line3.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        line3.frame = CGRectMake(10, pfjeTitLab.bottom +8, KWIDTH -20, 1);
        [bottomV addSubview:line3];
        
        UIButton *changeQuBtn = [[UIButton alloc] init];
        //changeQuBtn.backgroundColor = [UIColor redColor];
        changeQuBtn.frame = CGRectMake(bottomV.right - 162, line3.bottom +10, 69, 26);
        //changeQuBtn.layer.borderWidth = 1;
        //changeQuBtn.layer.borderColor = [UIColor colorWithHexString:@"#979797"].CGColor;
        [changeQuBtn setImage:[UIImage imageNamed:@"组 3550"] forState:UIControlStateNormal];
        [changeQuBtn addTarget:self action:@selector(changeQuBtnAction:) forControlEvents:UIControlEventTouchUpInside];
        [bottomV addSubview:changeQuBtn];
        self.changeQuBtn = changeQuBtn;
        
        UIButton *cancleOrBtn = [[UIButton alloc] init];
        //cancleOrBtn.backgroundColor = [UIColor redColor];
        cancleOrBtn.frame = CGRectMake(changeQuBtn.right +8, line3.bottom +10, 69, 26);
        //cancleOrBtn.layer.borderWidth = 1;
        //cancleOrBtn.layer.borderColor = [UIColor colorWithHexString:@"#979797"].CGColor;
        [cancleOrBtn setImage:[UIImage imageNamed:@"组 3507"] forState:UIControlStateNormal];
        [cancleOrBtn addTarget:self action:@selector(cancleOrBtnAction:) forControlEvents:UIControlEventTouchUpInside];
        [bottomV addSubview:cancleOrBtn];
        self.cancleOrBtn = cancleOrBtn;
        
    }
    return self;
}

//Cell上的 选择按钮 点击事件处理
- (void)rowSelBtnAction:(UIButton *)button {
    if (self.myblock) {
        self.myblock(0,@"");//减号
    }
    
    NSLog(@"您点击了 cell上边的 选择按钮");
}

//修改数量 按钮点击事件
- (void)changeQuBtnAction:(UIButton *)button {
    if (self.myblock) {
        self.myblock(1,@"");//修改数量
    }
    
    NSLog(@"您点击了 减号 按钮");
}

//取消预订 按钮点击事件
- (void)cancleOrBtnAction:(UIButton *)button {
    if (self.myblock) {
        self.myblock(2,@"");//取消预订
    }
    NSLog(@"您点击了 加号 按钮");
}

@end
